package SetDemo.Demo1;

import java.util.LinkedHashSet;

public class test2 {
    public static void main(String[] args){
        // 创建4个学生对象
        Student s1 = new Student("zhangsan",12);
        Student s2 = new Student("lisi",43);
        Student s3 = new Student("wangwu",42);
        Student s4 = new Student("zhangsan",12);

        // 创建集合对象
        LinkedHashSet<Student> lhs = new LinkedHashSet<>();

        // 向集合中添加元素
        lhs.add(s4);
        lhs.add(s1);
        lhs.add(s2);
        lhs.add(s3);
        System.out.println(lhs);
    }
}
